#include <bits/stdc++.h>
using namespace std;
vector<int>a[1005];
int n,num[1005];
int main(){
	cin>>n;
	for(int i=1;i<=n;++i){
		int m;cin>>m;
		for(int j=1;j<=m;++j){
			int x;cin>>x;
			a[i].push_back(x);
		}
		num[i]=i;
	}
	for(int i=1;i<=n;++i)sort(a[i].begin(),a[i].end());
	sort(a+1,a+n+1);
	for(int i=1;i<=n;++i){
		unsigned t=a[num[i]].size();
		for(unsigned j=0;j<t;++j)
			cout<<a[num[i]].at(j)<<' ';
		cout<<endl;
	}
	return 0;
}
